Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: disable animated transitions by default when prefers-reduced-motion: reduce #281

Merged
merged 8 commits into from
Feb 17, 2023

Conversation

Mysterious-Dev
Copy link
Contributor

@Mysterious-Dev Mysterious-Dev commented Jan 7, 2023

@netlify
Copy link

netlify bot commented Jan 7, 2023

Deploy Preview for infima ready!

Name Link
🔨 Latest commit 24af02d
🔍 Latest deploy log https://app.netlify.com/sites/infima/deploys/63ef5df592c1ec0008aee399
😎 Deploy Preview https://deploy-preview-281--infima.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@Mysterious-Dev Mysterious-Dev marked this pull request as draft January 7, 2023 13:50
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jan 7, 2023
@Mysterious-Dev Mysterious-Dev marked this pull request as ready for review January 7, 2023 16:47
@Mysterious-Dev
Copy link
Contributor Author

Ready for review. For infima, it's what I can done. As far as the mobile version of the TOC is concerned, this is normally done on the Docusaurus side.

@slorber
Copy link
Collaborator

slorber commented Jan 18, 2023

Thanks, will review it soon.

Was wondering if maybe we could use this CSS var trick to reduce motion everywhere at once?
https://www.silvestar.codes/articles/using-css-variables-for-reduced-motion-on-a-global-scale/

:root {
--ifm-transition-fast: 100ms;
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --ifm-transition-fast: 0ms;
  }
}

I didn't try nor study that solution in depth but that's probably worth exploring so that we avoid spreading the mediaqueries everywhere.

@Mysterious-Dev
Copy link
Contributor Author

Hmm, intresting, I will try this ^^.

@Mysterious-Dev
Copy link
Contributor Author

Mysterious-Dev commented Jan 18, 2023

By the way, can I add somes new variables for this ? Because in css, I have different speeds for some transitions.

Or maybe homogenise it.

@slorber
Copy link
Collaborator

slorber commented Jan 18, 2023

I don't know, if this makes sense we can create "design tokens" for speeds 🤪 I don't know how many different anim speeds we have

Comment on lines 246 to 249

@media (prefers-reduced-motion) {
@mixin transition visibility, 100ms, ease-in-out;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similarly, why do the backdrop appear before the sidebar?

I would test with the default 200ms anim delay for both and see if it looks good (not sure but worth testing to see if we can simplify)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I change the speed and delete media query. Don't hesitate to tell me if I need to change anything else.

@Mysterious-Dev
Copy link
Contributor Author

Any news ?

Copy link
Collaborator

@slorber slorber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks 👍

The new mobile menu backdrop anim timing doesn't look bad so we can keep it

@slorber slorber changed the title Use prefers-reduced-motion media feature to disable motion transitions for dropdown & navbar components feat: disable animated transitions by default when user prefers reduced motions (prefers-reduced-motion: reduce media) Feb 17, 2023
@slorber slorber changed the title feat: disable animated transitions by default when user prefers reduced motions (prefers-reduced-motion: reduce media) feat: disable animated transitions by default when prefers-reduced-motion: reduce Feb 17, 2023
@slorber slorber merged commit 8572861 into facebookincubator:main Feb 17, 2023
@Mysterious-Dev Mysterious-Dev deleted the prefers-reduced-motion branch February 17, 2023 11:13
@slorber
Copy link
Collaborator

slorber commented Feb 17, 2023

will be integrated in facebook/docusaurus#8674

@Mysterious-Dev
Copy link
Contributor Author

Nice ! However, the animation visible on the video below is managed by Docusaurus (with the willChange attribute etc...). I'm not sure how to support the media query 😅.

Enregistrement.2023-02-17.122019.mp4

@slorber
Copy link
Collaborator

slorber commented Feb 17, 2023

Yes, I added a few fixes on the Docusaurus side as well to handle that

@Mysterious-Dev
Copy link
Contributor Author

Perfect, thanks ^^.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants